// 科室列表
const departments = [
    { id: 1, name: '大气办' },
    { id: 2, name: '规划科' },
    { id: 3, name: '协调科' },
    { id: 4, name: '办公室' },
    { id: 5, name: '建设科' },
    { id: 6, name: '财务科' }
  ]

// 当前选中的科室，null表示所有科室
const currentDepartment = null

// 文件列表
const files = [
    { id: 1, name: '大气办文件.docx', departmentId: 1, type: 'word', size: '2.4MB', uploadTime: '2023-11-01 14:30' },
    { id: 2, name: '规划科文件.pdf', departmentId: 2, type: 'pdf', size: '5.7MB', uploadTime: '2023-11-02 09:15' },
    { id: 3, name: '协调科文件.docx', departmentId: 3, type: 'word', size: '1.8MB', uploadTime: '2023-11-03 10:45' },
    { id: 4, name: '办公室文件.pdf', departmentId: 4, type: 'pdf', size: '3.2MB', uploadTime: '2023-11-04 16:20' },
    { id: 5, name: '建设科文件.pdf', departmentId: 5, type: 'pdf', size: '8.5MB', uploadTime: '2023-11-05 11:05' },
    { id: 6, name: '财务科文件.docx', departmentId: 6, type: 'word', size: '2.1MB', uploadTime: '2023-11-06 15:30' },
    { id: 7, name: '年度总结报告.pdf', departmentId: null, type: 'pdf', size: '12.3MB', uploadTime: '2023-11-07 14:10' }
  ];

const filteredFiles = () => {
    if (currentDepartment === null) {
      return files;
    }
    return files.filter(file => file.departmentId === currentDepartment);
  }
  // 获取科室名称
const getDepartmentName = () => {
    return (id) => {
      if (id === null) return '全局文件';
      const dept = departments.find(d => d.id === id);
      return dept ? dept.name : '未知科室';
    };
  }

export default {
    departments,
    currentDepartment,
    files,
    filteredFiles,
    getDepartmentName
}
